<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" />
    <title>枣强通行码</title>
    <link rel="stylesheet" href="./layui/css/layui.css" media="all">
    <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/fastclick/1.0.6/fastclick.min.js"></script>
    <script src="./jquery/jquery.min.js"></script>
    <style>
        * {
            background: #F2F6FB;
        }

        .layui-text {
            background: #D7E8FF;
            line-height: 16px;
            color: #265DA4;
            font-weight: bolder;
            font-size: 16px;
        }

        .layui-input,
        .layui-textarea {
            width: 95%;
            background: #E9F1FB;
            border-color: #E9F1FB;
            border-radius: 4px;
            box-shadow: 0 0 14px 0 rgba(0, 0, 0, 0.2);
        }

        .layui-form-item .layui-form-label {
            text-overflow: clip;
        }

        .footer {
            text-align: center;
            font-size: 12px;
            color: #666666;
            position: fixed;
            bottom: 0;
            width: 100%;
        }

        .footer p {
            margin: 5px 0;
        }

        .layui-elem-quote {
            text-align: center;
            border-left: none;
        }

        .layui-form-radio>i:hover,
        .layui-form-radioed>i {
            color: #275DA4;
        }


        .layui-btn {
            background-color: #275DA4;
            box-shadow: 0 0 14px 0 rgba(0, 0, 0, 0.2);
        }

        .tishi {
            text-align: center;
            color: #666;
            font-size: 14px;
            margin-top: 10px;
            margin-bottom: 10px;
        }

        .layui-form-label {
            padding: 9px 9px 9px 0;
        }

        .layui-input-block {
            margin-left: 91px;
        }

        #launch-btn {
            width: 240px;
            padding-left: 60px;
            background: #fff;
        }

        .b {
            background-color: #cbcbcb;
        }

        .htmls {
            min-height: 480px;
        }
    </style>

</head>

<body>
    <blockquote class="layui-elem-quote layui-text">
        枣强通行码登记
    </blockquote>
    <form class="layui-form" action="">
        <div class="htmls">
            <input type="hidden" name="id" class="_id">
            <div style="text-align: center;height: 40px;line-height: 30px;">
                <div style="font-weight: bolder;font-size: 16px;color: #999;" class="title_"></div>
            </div>
            <div style="text-align: center;height: 40px;line-height: 30px;">
                <div style="font-weight: bolder;font-size: 14px;color: rgb(146, 9, 9);" class="people_"></div>
            </div>
            <div class="layui-form-item layui-form-phone">
                <label class="layui-form-label">密码*</label>
                <div class="layui-input-block">
                    <input type="number" name="secret" id="L_phone" lay-verify="required" lay-reqtext="请输入密码"
                        placeholder="请输入密码" autocomplete="off" class="layui-input layui_phone" maxlength="20">
                </div>
            </div>
            <div class="layui-form-item" style="text-align: center;">
                <button type="submit" class="layui-btn layui-date" lay-submit="" lay-filter="demo1"
                    style="width: 200px;">下一步</button>
            </div>
        </div>
        <img src="http://hesuan.city1000.cn/images/tishi.png" alt="" width="90%"
            style="margin-left: 4%;margin-top: 20px;">
        <div class="tishi">技术支持: 澄怀科技</div>
    </form>
    <script src="./layui/layui.js"></script>
    <script src="./api/api.js?v=01"></script>
    <script>
        layui.use(['form', 'layer', 'jquery'], function () {
            var form = layui.form,
                layer = layui.layer,
                $ = layui.jquery;
            //从两个按钮的页面跳转过来的open_datas 包括 openid 和 rukouId 和 身份证号 和中文的入口地址 和姓名

            var open_data = getQueryVariable("state")
            console.log("上一个页面的参数:" + open_data)
            if (open_data.split('+').length > 3) {
                var rukouId = open_data.split("+")[1]
                var rukouName = open_data.split("+")[3]
                var openId = open_data.split("+")[0]
                var idCard = open_data.split("+")[2]
            }
            $("._id").val(rukouId)
            $(".title_").html(rukouName)
            $(".people_").html(open_data.split("+")[4])
            $(document).ready(function () {
                // 防止按钮延迟
                FastClick.attach(document.body);
            })
            //监听提交

            form.on('submit(demo1)', function (data) {
                var loadIndex;
                $.post(ymt_api + "/ymtUserDanwei/checkSecret", {
                    secret: data.field.secret,
                    id: data.field.id
                }, function (res) {
                    console.log(res)
                    if (res.code == 0) {
                        //alert('输入密码成功')
                        // order_data中有入口id 入口中文名 openid 身份证号
                        var order_data =
                            `${rukouId}+${rukouName}+${openId}+${open_data.split("+")[4]}`
                        window.location.href =
                            encodeURI('http://hesuan.city1000.cn/zq/yes.html?state=' +
                                order_data + "&idCard=" + idCard)
                    } else {
                        // 失败
                        layer.confirm(res.msg, {
                            title:"系统提示"
                        });
                    }
                })


                return false;
            });
        })

        function getQueryVariable(variable) {
            var query = decodeURI(window.location.search.substring(1))
            var vars = query.split("&");
            for (var i = 0; i < vars.length; i++) {
                var pair = vars[i].split("=");
                if (pair[0] == variable) {
                    return pair[1];
                }
            }
            return (false);
        }
    </script>
</body>

</html>